package com.joycessh.action.cdgl;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.joycessh.service.ICdglService;
import com.joycessh.service.impl.CdglServiceImpl;
import com.opensymphony.xwork2.ActionSupport;

import net.sf.json.JSONObject;

@SuppressWarnings("serial")
public class DeleteVenueAction extends ActionSupport{

	private ICdglService cdglService;	
	private String result;	
	private String message;
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	
	@Override
	public String execute() throws Exception {
		cdglService = new CdglServiceImpl();		
		try {
			HttpServletRequest request = ServletActionContext.getRequest();
			String venueId = request.getParameter("venue_id");						
			
			//调用添加场地服务，返回提示信息
			message = cdglService.deleteCourt(venueId);

			Map<String,Object> map = new HashMap<String,Object>();

			map.put("message", message);
			//将map对象转换成json类型数据*/
			JSONObject json = JSONObject.fromObject(map);
			//System.out.println(json);
			//给result赋值，传递给页面
			result = json.toString();
			
		}catch(Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
		
	}
}
